// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import VeeValidate,{ Validator } from 'vee-validate';
import VueResource from 'vue-resource'

const config = {
  errorBagName: 'errors', // change if property conflicts.
  fieldsBagName: 'fields', 
  delay: 0, 
  locale: 'zh_CN', 
  dictionary: null, 
  strict: true, 
  classes: false, 
  classNames: {
    touched: 'touched', // the control has been blurred
    untouched: 'untouched', // the control hasn't been blurred
    valid: 'valid', // model is valid
    invalid: 'invalid', // model is invalid
    pristine: 'pristine', // control has not been interacted with
    dirty: 'dirty' // control has been interacted with
  },
  events: 'input|blur',
  inject: true,
  validity: true,
  aria: true
};

const dictionary = {
  zh_CN: {
    messages: {
    	required: () => '必填项',
      	email: () => '邮箱格式不正确哦'
    }
  }
};
Validator.updateDictionary(dictionary);

Vue.use(VeeValidate, config);
Vue.use(VueResource);
/*CSS Libs*/
import './assets/lib/css/bootstrap.min.css'
import './assets/lib/css/font-awesome.min.css'
import './assets/lib/css/animate.min.css'
import './assets/lib/css/bootstrap-switch.min.css'
import './assets/lib/css/checkbox3.min.css'
import './assets/lib/css/jquery.dataTables.min.css'
import './assets/lib/css/dataTables.bootstrap.css'
import './assets/lib/css/select2.min.css'
/*CSS App*/
import './assets/css/style.css'
import './assets/css/themes/flat-blue.css'

/*Javascript Libs*/
import './assets/lib/js/bootstrap.min.js'
//import Chart from './assets/lib/js/Chart.min.js'
//import './assets/lib/js/bootstrap-switch.min.js'
import './assets/lib/js/jquery.matchHeight-min.js'
import './assets/lib/js/jquery.dataTables.min.js'
import './assets/lib/js/select2.full.min.js'
import './assets/lib/js/bootstrap.min.js'
//import './assets/lib/js/ace/ace.js'
//import './assets/lib/js/ace/mode-html.js'
//import './assets/lib/js/ace/theme-github.js'
/*Javascript*/

//import './assets/js/index.js'


import '../static/UE/ueditor.config.js'
import '../static/UE/ueditor.all.min.js'
import '../static/UE/lang/zh-cn/zh-cn.js'
import '../static/UE/ueditor.parse.min.js'


//引入公用组件
import CustomForm from './components/CustomForm.vue'

Vue.component('CustomForm',CustomForm)

Vue.config.productionTip = false

Vue.filter('time', function (value) {//value为13位的时间戳
	if(!value){
		//alert(value)
		value=Date.parse(new Date())/1000;
	}
    function add0(m) {
        return m < 10 ? '0' + m : m
    }
    var time = new Date(parseInt(value)*1000);
    var y = time.getFullYear();
    var m = time.getMonth() + 1;
    var d = time.getDate();
    var h = time.getHours();
    var mi = time.getMinutes();
    var s = time.getSeconds();

    return y + '-' + add0(m) + '-' + add0(d)+'    '+add0(h)+':'+add0(mi)+':'+add0(s);
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  template: '<App/>',
  components: { App }
})
